﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterNhanSuTienLuong.Master" Inherits="System.Web.Mvc.ViewPage<DTTB.MV2.QUANLYNHANSUTIENLUONG.Models.FormBean.PhanQuyen.RolesForm>" %>

<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="DTTB.DTO" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <!-- include some files -->

    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/Roles/Role.js") %>"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            selectMenu("system-Roles");
            $("#system-Roles").parent().attr("class", "active");
            $("#GiaTriSearch").focus();
        });
       
    </script>

    <form name="RolesForm" action="" method="post" class="formBox">
    <%=Html.Hidden("RolesID")%>
   <%-- <div class="module">--%>
   <div class="box">        
		<!-- box / title -->
        
        
       <div class="breadcrumbs">
          <ul>
            <li class="home"><a href="">Phân Quyền</a></li>
            <li><a href="">Quản lý quyền</a></li>
            <li>Page</li>
          </ul>
        </div>
           <div class="headlines">
            <h2>
                <span>Quản lý quyền</span>
            </h2>
               <%-- <a class="show-filter" href="#">show filter</a>--%>
        </div>
            <table class="table_outsite" style="width: 100%">
                <tr>
                    <td align="left">
                        <%--Thông Báo--%>
                        <%
                            if (Model.MessageCreateRoles != null)
                            {
                        %>
                        <div id="MessageCreateRoles" style="font-size: 12px; color: Blue; font-weight: bold">
                            <%=Model.MessageCreateRoles %></div>
                        <%
                            }
                        %>
                        <%
                            if (Model.MessageEditRoles != null)
                            {
                        %>
                        <div id="MessageEditRoles" style="font-size: 12px; color: Blue; font-weight: bold">
                            <%=Model.MessageEditRoles %></div>
                        <%
                            }
                        %>
                        <%--end--%>
                    </td>
                    <td align="right" class="btn-submit">
                        <input type="button" class="button" value="Tạo/Cập nhật" onclick="javascript:DoCreateOrEdit();" />
                        <input type="button" class="button"value="Tạo mới" onclick="javascript:NewAjax();" />
                        <input type="button" class="button"value="Xóa" onclick='javascript:DeleteRole();' />
                        <input type="reset" class="button"value="Nhập lại" onclick="javascript:ResetRole();" />
                    </td>
                </tr>
                 </table >
                <table class="table_input" width="100%">
                <tr>
                    <td>
                        <%--Mã quyền:--%>
                    </td>
                    <td colspan="3">
                        <%--<input type="text" name="IdRole" id="IdRole" class="gray" readonly="readonly" value='<%=Model.ID %>' size="30" />--%>
                        <input type="hidden" name="IdRole" id="IdRole" value='<%=Model.ID %>' />
                        <%=Html.Hidden("IdHidden", Model.ID) %>
                    </td>
                </tr>
                <tr>
                    <td width="10%"><b>Tên quyền:</b></td>
                    <td width="48%">
                        <%= Html.TextBox("RoleName", Model.RoleName, new { @style = "width:80%" })%>
                        <div id="RoleNameMessage" style="color: Red;">
                        </div>
                    </td>
                    <td style="width: 12%" class="lab"nowrap="nowrap">Ngày tạo:</td>
                    <td class="gray" style="width: 35%">
                        <%=Html.TextBox("CreateDate", Model.CreateDate.ToString("dd/MM/yyyy"), new { @size = "30", @disabled = "disabled", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("CreateDateHidden", Model.CreateDate.ToShortDateString())%>
                    </td>
                </tr>
                <tr>
                    <td class="lab"nowrap="nowrap">
                        Mô tả :
                    </td>
                    <td>
                        <%=Html.TextBox("Description", Model.Description, new { @style = "width:80%" })%>&nbsp;
                    </td>
                    <td class="lab"nowrap="nowrap">
                        Ngày cập nhật:
                    </td>
                    <td class="gray">
                        <%=Html.TextBox("UpdateDate", Model.UpdateDate.ToString("dd/MM/yyyy"), new { @size = "30", @disabled = "disabled", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("UpdateDateHidden", Model.UpdateDate.ToShortDateString())%>
                    </td>                    
                </tr>
                <tr>
                    <td class="lab"nowrap="nowrap">
                        Kích hoạt :
                    </td>
                    <td>
                        <%=Html.CheckBox("IsEnable", Model.IsEnable)%>
                        <%=Html.Hidden("IsEnableHidden", Model.IsEnable)%>
                    </td>
                    <td class="lab" nowrap="nowrap">
                        Người tạo:
                    </td>
                    <td class="gray">
                        <%=Html.TextBox("CreateBy", Model.CreateByUser, new { @size = "30", @disabled = "disabled", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("CreateByHidden", Model.CreateByUser)%>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        &nbsp;
                    </td>
                    <td class="lab" nowrap="nowrap">
                        Người cập nhật:
                    </td>
                    <td>
                        <%=Html.TextBox("UpdateBy", Model.UpdateByUser, new { @size = "30", @disabled = "disabled", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("UpdateByHidden", Model.UpdateByUser)%>
                    </td>
                    
                </tr>
                
            </table>
            <div class="pagebreak">&nbsp;</div>
            <!-- Role list -->
            <table class="table_outsite" width="100%" >
                
                <tr>
                    <td colspan="2" class="first">
                        &nbsp;<b>Danh sách quyền:</b>
                    </td>
                    <td colspan="2" class="first" align="right">
                        <%=Html.DropDownList("TieuChiSearch", Model.TieuChiSearchDropDownList)%>
                        <%=Html.TextBox("GiaTriSearch", Model.GiaTriSearch, new { @onkeypress = "if (event.keyCode==13) { return DoSearch(); }", Style = "width:210px" })%>
                        <img onclick="javascript:DoSearch();" style="vertical-align: middle; cursor:pointer" src="<%=ResolveUrl("~/Content/ImagesAdmin/search_icon.gif")%>"
                            alt="Tìm quyền" title="Tìm quyền"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <table border="0" cellspacing="0" cellpadding="0" class="tab tab-drag">
                            <tr class="top nodrop nodrag" style="font-weight: bold">
                                <td class="first" width="10%" align="center">
                                    &nbsp;<strong>STT</strong>
                                </td>
                                <td nowrap="nowrap">
                                    &nbsp;<strong>Tên quyền</strong>
                                </td>
                                <td nowrap="nowrap">
                                    &nbsp;<strong>Mô tả</strong>
                                </td>
                                <td nowrap="nowrap" align="center">
                                    <strong >Đang sử dụng</strong>
                                </td>
                                <td nowrap="nowrap" align="center">
                                    <strong>Permission</strong>
                                </td>
                                <td nowrap="nowrap">
                                    &nbsp;<strong>Ngày cập nhật</strong>
                                </td>
                                <td width="14%" class="last"  nowrap="nowrap">
                                    &nbsp;<strong>Người cập nhật</strong>
                                </td>
                            </tr>
                            <%
                                IList<RolesDto> dtos = Model.RolesPagedList;
                                int dem = 0;
                                foreach (RolesDto dto in dtos)
                                {%>
                            <tr class="item_row" onclick="highlight(this);EditAjax(<%=dto.ID %>);">
                                <td class="first" align="center">
                                   <%=++dem %>
                                </td>
                                <td>
                                    &nbsp;<%=dto.RoleName %>
                                </td>
                                <td>
                                    &nbsp;<%=dto.Description ?? string.Empty %>
                                </td>
                                <td style="text-align:center">
                                    <%if (dto.IsUsed)
                                      {%>
                                    Yes
                                    <%}
                                      else
                                      {%>
                                    No
                                    <%}%>
                                </td>
                                <td style="text-align:center">
                                    <%if (dto.HavePermission)
                                      {%>
                                    Yes
                                    <%}
                                      else
                                      {%>
                                    No
                                    <%}%>
                                </td>
                                <td>
                                    &nbsp;<%=dto.UpdateDate.ToString("dd/MM/yyyy")%>
                                </td>
                                <td class="last" nowrap="nowrap">
                                    &nbsp;<%=dto.UpdateByUser%>
                                </td>
                            </tr>
                            <% } %>
                            <tr class="border_bottom">
                                <td class="first" style="background: #DDDDDD">
                                </td>
                                <td class="last" colspan="6" align="right" style="background: #DDDDDD; padding-right: 10px">
                                    <div>
                                        <%=Html.Pager(Model.RolesPagedList,new PagerOptions{PageIndexParameterName="id"}) %></div>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            
        <%--</div>--%>
    </div>
   <%-- </div>--%>
   
    </form>
</asp:Content>
